const Router = require('koa-router')
const axios = require('axios')
const config = require('../config')

const dictRouter = new Router({
  prefix: '/recordApi/dict'
})

dictRouter.get('/all', async ctx => {
  let simple = axios.get(`${config.api}/dict/simple`)
  let complex = axios.get(`${config.api}/dict/complex`)
  const [simples, complexs] = await axios.all([simple, complex])
  ctx.body = {
    simple: simples.data,
    complex: complexs.data
  }
})

module.exports = dictRouter